package com.micro.service.mongoDao;

import com.mongodb.client.result.DeleteResult;
import org.springframework.data.mongodb.core.query.Query;
import org.springframework.data.mongodb.core.query.Update;

import java.util.List;

/**
 * Create by Vic Xu on 2019/3/9
 */
public interface BaseMongoDao<T> {

    void insert(T t);

    DeleteResult delete(T t);

    DeleteResult deleteById(Object id);

    DeleteResult deleteByCondition(T t);

    DeleteResult delete(Query query);

    void update(T t);

    void update(Query query, Update update);

    T findById(Object id);

    List<T> findAll();

    List<T> find(Query query);

    List<T> findByCondition(T t);

    T findById(String id);

    boolean exists(Query query);

    boolean exists(T t);

    boolean exitsById(Object id);

    long count(Query query);

}
